Re: [SQL] convert text to varchar - Mailing list pgsql-sql

From Herouth Maoz
Subject Re: [SQL] convert text to varchar
Date
Msg-id l03130308b3537874e3d1@[147.233.159.109]
Whole thread Raw
In response to convert text to varchar  (JT Kirkpatrick <jt-kirkpatrick@mpsllc.com>)
List pgsql-sql
At 18:33 +0300 on 03/05/1999, JT Kirkpatrick wrote:


> hi!  i have a text field (table ap3, field name apnote) that i would like
> to insert into a varchar field (same field name, table name ap).  any idea
> why this doesn't work?  insert into ap (apnote) select varchar('apnote')
> from ap3; -- it fails with or without the single quotes.

Should be simply

INSERT INTO ap (apnote)
SELECT ap3.apnote
FROM ap3;

You really shouldn't have single quotes, and the conversion to text is
supposed to be automatic.

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma




pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: [SQL] Slow Inserts Again
Next
From: Bruce Momjian
Date:
Subject: Re: [SQL] No DIVIDE Operator